﻿namespace RL
{
    
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.Design;
    using System.Drawing;
    using System.Drawing.Design;
    using System.IO;
    using System.Runtime.CompilerServices;
    using System.Text;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Xml.Serialization;

    [Designer(typeof(AjaxPlaceHolderDesigner)), ToolboxBitmap(typeof(RL.AjaxPlaceHolder), "AjaxPlaceHolder.png"), DefaultProperty("AfterBody"), DefaultEvent("NeedBodyContent")]
    public class AjaxPlaceHolder : PlaceHolder
    {
		#region Fields (18) 

        private BlockUI _blockUi;
        private string _InjectedAjaxRequestEnd = string.Empty;
        private string _InjectedAjaxRequestStart = string.Empty;
        private string _InjectedBodyScript = string.Empty;
        private ArrayList _InjectedCssFiles = new ArrayList();
        private string _InjectedDomLoad = string.Empty;
        private string _InjectedEvents = string.Empty;
        private string _InjectedFunctions = string.Empty;
        private string _InjectedHeaderScript = string.Empty;
        private ArrayList _InjectedJSFiles = new ArrayList();
        private string _InjectedWindowLoad = string.Empty;
        private JQuery _Jquery;
        private WebsitePaths _Paths;
        public HtmlInputHidden AjaxMessageKeeper = new HtmlInputHidden();
        public static string LineBrk = "\r\n";
        internal static string PluginSessionkey = "AjaxPlaceHolderSessionStore";
        internal List<IPlugin> RegisteredPlugins = new List<IPlugin>();
        public AjaxPlaceHolderConfig Settings;

		#endregion Fields 

		#region Enums (2) 

        public enum Content
        {
            CssFiles,
            JSFiles,
            DomLoad,
            WindowLoad,
            HeaderScript,
            BodyScript,
            AjaxRequestStart,
            AjaxRequestEnd,
            AjaxMessageFoundCondition
        }
public enum HtmlEvent
        {
            blur,
            change,
            click,
            dblclick,
            error,
            focus,
            keydown,
            keypress,
            keyup,
            load,
            mousedown,
            mousemove,
            mouseout,
            mouseover,
            mouseup,
            resize,
            scroll,
            select,
            submit,
            unload
        }

		#endregion Enums 

		#region Properties (22) 

        [Description("files on different path. refer the fully qualified name. these files are outside of the resource directory somewhere"), Category("Script Files"), TypeConverter(typeof(StringArrayConverter))]
        public string[] AdditionalScriptFiles
        {
            get
            {
                return ((this.ViewState["AdditionalScriptFiles"] == null) ? new string[0] : ((string[]) this.ViewState["AdditionalScriptFiles"]));
            }
            set
            {
                this.ViewState["AdditionalScriptFiles"] = value;
            }
        }

        [Category("Style"), TypeConverter(typeof(StringArrayConverter)), Description("files on different path. refer the fully qualified name. these files are outside of the resource directory somewhere")]
        public string[] AdditionalStyleSheets
        {
            get
            {
                return ((this.ViewState["AdditionalStyleSheets"] == null) ? new string[0] : ((string[]) this.ViewState["AdditionalStyleSheets"]));
            }
            set
            {
                this.ViewState["AdditionalStyleSheets"] = value;
            }
        }

        [Category("Resources"), Description("Add Script into head section or body section")]
        public bool AddResourcesInHead
        {
            get
            {
                return ((this.ViewState["AddResourcesInHead"] != null) && bool.Parse(this.ViewState["AddResourcesInHead"].ToString()));
            }
            set
            {
                this.ViewState["AddResourcesInHead"] = value;
            }
        }

        [Description("code inside the body script, after added all default scripts"), Category("My Code"), Editor(typeof(MultilineStringEditor), typeof(UITypeEditor))]
        public string AfterBody
        {
            get
            {
                return ((this.ViewState["AfterBody"] == null) ? string.Empty : this.ViewState["AfterBody"].ToString());
            }
            set
            {
                this.ViewState["AfterBody"] = value;
            }
        }

        [Editor(typeof(MultilineStringEditor), typeof(UITypeEditor)), Description("code inside script block, after adding all script files and stylesheets"), Category("My Code")]
        public string AfterHeader
        {
            get
            {
                return ((this.ViewState["AfterHeader"] == null) ? string.Empty : this.ViewState["AfterHeader"].ToString());
            }
            set
            {
                this.ViewState["AfterHeader"] = value;
            }
        }

        [Category("My Code"), Editor(typeof(MultilineStringEditor), typeof(UITypeEditor)), Description(" what happens when ajax message recieved ")]
        public string AjaxMsgFoundMethod
        {
            get
            {
                return ((this.ViewState["AjaxMsgFoundMethod"] == null) ? string.Empty : this.ViewState["AjaxMsgFoundMethod"].ToString());
            }
            set
            {
                this.ViewState["AjaxMsgFoundMethod"] = value;
            }
        }

        [Category("My Code"), Editor(typeof(MultilineStringEditor), typeof(UITypeEditor)), Description(" in the body section script, your code before any other code")]
        public string BeforeBody
        {
            get
            {
                return ((this.ViewState["BeforeBody"] == null) ? string.Empty : this.ViewState["BeforeBody"].ToString());
            }
            set
            {
                this.ViewState["BeforeBody"] = value;
            }
        }

        [Editor(typeof(MultilineStringEditor), typeof(UITypeEditor)), Description("code inside script block, before other default code"), Category("My Code")]
        public string BeforeHeader
        {
            get
            {
                return ((this.ViewState["BeforeHeader"] == null) ? string.Empty : this.ViewState["BeforeHeader"].ToString());
            }
            set
            {
                this.ViewState["BeforeHeader"] = value;
            }
        }

        public BlockUI BlockUi
        {
            get
            {
                if (this._blockUi == null)
                {
                    this._blockUi = new BlockUI(this);
                    this.RegisterJqueryPlugin(this._blockUi);
                }
                return this._blockUi;
            }
            set
            {
            }
        }

        [Description("the Ajax Configuration File"), Category("Xml Configuration")]
        public string ConfigurationFile
        {
            get
            {
                return ((this.ViewState["ConfigurationFile"] == null) ? "AjaxPlaceHolder.config" : this.ViewState["ConfigurationFile"].ToString());
            }
            set
            {
                this.ViewState["ConfigurationFile"] = value;
            }
        }

        [Description("No script would be generated if disabled")]
        public bool Enabled
        {
            get
            {
                return ((this.ViewState["Enabled"] == null) || Convert.ToBoolean(this.ViewState["Enabled"].ToString()));
            }
            set
            {
                this.ViewState["Enabled"] = value;
            }
        }

        [Description("code inside InsideAjaxEnd Event"), Category("My Code"), Editor(typeof(MultilineStringEditor), typeof(UITypeEditor))]
        public string InsideAjaxEnd
        {
            get
            {
                return ((this.ViewState["InsideAjaxEnd"] == null) ? string.Empty : this.ViewState["InsideAjaxEnd"].ToString());
            }
            set
            {
                this.ViewState["InsideAjaxEnd"] = value;
            }
        }

        [Category("My Code"), Editor(typeof(MultilineStringEditor), typeof(UITypeEditor)), Description("code inside InsideAjaxStart Event")]
        public string InsideAjaxStart
        {
            get
            {
                return ((this.ViewState["InsideAjaxStart"] == null) ? string.Empty : this.ViewState["InsideAjaxStart"].ToString());
            }
            set
            {
                this.ViewState["InsideAjaxStart"] = value;
            }
        }

        [Description("code inside DomLoadEvent"), Editor(typeof(MultilineStringEditor), typeof(UITypeEditor)), Category("My Code")]
        public string InsideDomLoad
        {
            get
            {
                return ((this.ViewState["InsideDomLoad"] == null) ? string.Empty : this.ViewState["InsideDomLoad"].ToString());
            }
            set
            {
                this.ViewState["InsideDomLoad"] = value;
            }
        }

        [Description("code inside InsideWindowLoad Event"), Category("My Code"), Editor(typeof(MultilineStringEditor), typeof(UITypeEditor))]
        public string InsideWindowLoad
        {
            get
            {
                return ((this.ViewState["InsideWindowLoad"] == null) ? string.Empty : this.ViewState["InsideWindowLoad"].ToString());
            }
            set
            {
                this.ViewState["InsideWindowLoad"] = value;
            }
        }

        public JQuery Jquery
        {
            get
            {
                if (this._Jquery == null)
                {
                    this._Jquery = new JQuery(this);
                }
                return this._Jquery;
            }
            set
            {
                this._Jquery = value;
            }
        }

        public string LineBreak
        {
            get
            {
                return LineBrk;
            }
        }

        internal WebsitePaths Paths
        {
            get
            {
                if (this._Paths == null)
                {
                    this._Paths = new WebsitePaths(this);
                }
                return this._Paths;
            }
            set
            {
                this._Paths = value;
            }
        }

        [Category("Resources"), Description("one stop for all script,css and configuration files"), TypeConverter(typeof(StringConverter))]
        public string ResourceDirectory
        {
            get
            {
                return ((this.ViewState["ResourceDirectory"] == null) ? "/AjaxPlaceHolder/" : 
								this.ViewState["ResourceDirectory"].ToString().EnsureWebSlashInTheEnd());
            }
            set
            {
                this.ViewState["ResourceDirectory"] = value;
            }
        }

        [TypeConverter(typeof(StringArrayConverter)), Category("Script Files"), Description("js files, will be included in the header of current page")]
        public string[] ScriptFiles
        {
            get
            {
                return ((this.ViewState["ScriptFiles"] == null) ? new string[] { "AjaxPlaceHolder.js", "jquery.js" } : ((string[]) this.ViewState["ScriptFiles"]));
            }
            set
            {
                this.ViewState["ScriptFiles"] = value;
            }
        }

        [Description("css files, will be included in the header of current page"), TypeConverter(typeof(StringArrayConverter)), Category("Style")]
        public string[] StyleSheets
        {
            get
            {
                return ((this.ViewState["StyleSheets"] == null) ? new string[] { "AjaxPlaceHolder.css" } : ((string[]) this.ViewState["StyleSheets"]));
            }
            set
            {
                this.ViewState["StyleSheets"] = value;
            }
        }

        [Description("The Split Word/Character you use to split arguments in Ajax Message through UpdatePanel. The first parameter should use StatusBar.Position enum value string to select the method you like to call."), Category("Asp.Net Ajax")]
        public string UpdateMsgSpliter
        {
            get
            {
                return ((this.ViewState["AjaxUpdateMsgSpliter"] == null) ? "," : this.ViewState["AjaxUpdateMsgSpliter"].ToString());
            }
            set
            {
                this.ViewState["AjaxUpdateMsgSpliter"] = value;
            }
        }

		#endregion Properties 

		#region Delegates and Events (7) 

		// Delegates (1) 

        public delegate void AjaxPlaceHolderEventHanlder(RL.AjaxPlaceHolder ajax, AjaxPlaceHolderEventArgs e);
		// Events (6) 

        [Category("Asp.Net Ajax")]
        public event AjaxPlaceHolderEventHanlder AjaxRequestEnd;

        [Category("Asp.Net Ajax")]
        public event AjaxPlaceHolderEventHanlder AjaxRequestStart;

        [Category("$(document).ready")]
        public event AjaxPlaceHolderEventHanlder DomReady;

        [Category("Body Content")]
        public event AjaxPlaceHolderEventHanlder NeedBodyContent;

        [Category("Head Content")]
        public event AjaxPlaceHolderEventHanlder NeedHeaderContent;

        [Category("$(window).load")]
        public event AjaxPlaceHolderEventHanlder WindowLoad;

		#endregion Delegates and Events 

		#region Methods (18) 

		// Public Methods (12) 

        public static string EndScript()
        {
            return "</script>";
        }

        public static string Function(string name, string code, params string[] parameters)
        {
            StringBuilder sb = new StringBuilder();
            utility.sbAppp(sb, FunctionStubStart(name, parameters).ToString());
            utility.sbAppp(sb, code.ToString());
            utility.sbAppp(sb, FunctionStubEnd().ToString());
            return sb.ToString();
        }

        public static string Function(string name, StringBuilder code, params string[] parameters)
        {
            StringBuilder sb = new StringBuilder();
            utility.sbAppp(sb, FunctionStubStart(name, parameters).ToString());
            utility.sbAppp(sb, code.ToString());
            utility.sbAppp(sb, FunctionStubEnd().ToString());
            return sb.ToString();
        }

        public static string FunctionStubEnd()
        {
            return " } ";
        }

        public static string FunctionStubStart(string name, params string[] parameters)
        {
            StringBuilder sb = new StringBuilder();
            utility.sbAppp(sb, "function");
            utility.sbAppp(sb, name + "(");
						utility.sbAppp(sb, parameters.ToList<string>().ToCommaSeparatedString<string>() + ")");
            utility.sbAppp(sb, "{");
            return sb.ToString();
        }

        public void InjectInto(Content block, string text)
        {
            switch (block)
            {
                case Content.CssFiles:
                    this._InjectedCssFiles.Add(text);
                    break;

                case Content.JSFiles:
                    this._InjectedJSFiles.Add(text);
                    break;

                case Content.DomLoad:
                    this._InjectedDomLoad = this._InjectedDomLoad + text;
                    break;

                case Content.WindowLoad:
                    this._InjectedWindowLoad = this._InjectedWindowLoad + text;
                    break;

                case Content.HeaderScript:
                    this._InjectedHeaderScript = this._InjectedHeaderScript + text;
                    break;

                case Content.BodyScript:
                    this._InjectedBodyScript = this._InjectedBodyScript + text;
                    break;

                case Content.AjaxRequestStart:
                    this._InjectedAjaxRequestStart = this._InjectedAjaxRequestStart + text;
                    break;

                case Content.AjaxRequestEnd:
                    this._InjectedAjaxRequestEnd = this._InjectedAjaxRequestEnd + text;
                    break;
            }
        }

        public void InjectInto(string JQuerySelector, HtmlEvent Event, string Code)
        {
            this._InjectedEvents = this._InjectedEvents + LineBrk + JQuery.Event(JQuerySelector, Event, Code);
        }

        public void InjectInto(string FunctionName, string Code, params string[] Arguments)
        {
            this._InjectedFunctions = this._InjectedFunctions + LineBrk + Function(FunctionName, Code, Arguments) + LineBrk;
        }

        public void RedirectWithMessage(string MessageCallCode, string url, bool EndResponse)
        {
            bool flag = url.IndexOf("?") > -1;
            bool flag2 = url.IndexOf("&") > -1;
            bool flag3 = false;
            if (url.Substring(url.Length - 1, 1) == "?")
            {
                flag3 = true;
            }
            string str2 = Guid.NewGuid().ToString();
            this.Page.Session[str2] = MessageCallCode;
            if (!flag)
            {
                this.Page.Response.Redirect(url + "?AjxMngrMsgGuid=" + str2, EndResponse);
            }
            if ((flag && !flag2) && flag3)
            {
                this.Page.Response.Redirect(url + "AjxMngrMsgGuid=" + str2, EndResponse);
            }
            if (!((!flag || flag2) || flag3))
            {
                this.Page.Response.Redirect(url + "&AjxMngrMsgGuid=" + str2, EndResponse);
            }
            if (flag && flag2)
            {
                this.Page.Response.Redirect(url + "&AjxMngrMsgGuid=" + str2, EndResponse);
            }
        }

        public void RegisterJqueryPlugin(IPlugin Plugin)
        {
            this.RegisteredPlugins.Add(Plugin);
        }

        public static string SetTimeout(string func, int time)
        {
            return ("setTimeout('" + func + "', " + time.ToString() + ");");
        }

        public static string StartScript()
        {
            return "<script language=\"JavaScript\" type=\"text/javascript\" >";
        }
		// Protected Methods (4) 

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (this.Enabled)
            {
                try
                {
                    FileStream stream = new FileStream(HttpContext.Current.Server.MapPath(
											this.ResourceDirectory.EnsureWebSlashInTheEnd()) 
											+ this.ConfigurationFile, FileMode.Open);
                    XmlSerializer serializer = new XmlSerializer(typeof(AjaxPlaceHolderConfig));
                    stream.Close();
                }
                catch (Exception)
                {
                }
            }
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if (this.Page.Request["AjxMngrMsgGuid"] != null)
            {
                string str = this.Page.Request["AjxMngrMsgGuid"].ToString();
                if (this.Page.Session[str] != null)
                {
                    this.InjectInto(Content.WindowLoad, this.Page.Session[str].ToString());
                    this.Page.Session[str] = null;
                }
            }
        }

        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            if (this.Enabled)
            {
                StringBuilder builder = new StringBuilder(LineBrk);
                if (this.AddResourcesInHead)
                {
                    builder.Append(this.IncludeResources());
                    builder.Append(LineBrk);
                }
                builder.Append(StartScript());
                builder.Append(LineBrk);
                builder.Append(this.BeforeHeader);
                builder.Append(LineBrk);
                builder = new StringBuilder(this.fire(this.NeedHeaderContent, builder.ToString()));
                builder.Append(LineBrk);
                builder.Append(this.AfterHeader);
                builder.Append(LineBrk);
                builder.Append(this._InjectedHeaderScript);
                builder.Append(LineBrk);
                builder.Append(EndScript());
                builder.Append(LineBrk);
                this.Page.Header.Controls.Add(new LiteralControl(builder.ToString()));
            }
        }

        protected override void Render(HtmlTextWriter writer)
        {
            base.Render(writer);
            this.AjaxMessageKeeper.ID = "AjaxMessageKeeper";
            this.Controls.Add(this.AjaxMessageKeeper);
            this.AjaxMessageKeeper.RenderControl(writer);
            try
            {
                if (this.Enabled)
                {
                    StringBuilder builder = new StringBuilder(LineBrk);
                    builder.Append(StartScript());
                    builder.Append(LineBrk);
                    builder.Append(this._InjectedFunctions);
                    builder.Append(LineBrk);
                    builder.Append(JQuery.DomReadyStubStart());
                    builder.Append(LineBrk);
                    builder.Append(this._InjectedEvents);
                    builder.Append(LineBrk);
                    builder.Append(StatusBar.Initialization);
                    builder.Append(LineBrk);
                    builder.Append(JQuery.EventStubStart("window", "load"));
                    builder.Append(LineBrk);
                    builder = new StringBuilder(this.fire(this.WindowLoad, builder.ToString()));
                    builder.Append(LineBrk);
                    builder.Append(this._InjectedWindowLoad);
                    builder.Append(LineBrk);
                    builder.Append(JQuery.EventStubEnd());
                    builder.Append(LineBrk);
                    builder = new StringBuilder(this.fire(this.DomReady, builder.ToString()));
                    builder.Append(LineBrk);
                    builder.Append(this._InjectedDomLoad);
                    builder.Append(LineBrk);
                    builder.Append(JQuery.DomReadyStubEnd());
                    builder.Append(LineBrk);
                    builder.Append(StatusBar.SetHideTimeout);
                    builder.Append(LineBrk);
                    builder.Append(StatusBar.HideStatus);
                    builder.Append(LineBrk);
                    builder.Append(StatusBar.FadeoutStatus);
                    builder.Append(LineBrk);
                    builder.Append(StatusBar.SetFadeTimeout);
                    builder.Append(LineBrk);
                    builder.Append(StatusBar.showStatusMessage);
                    builder.Append(LineBrk);
                    builder.Append(AspNetAjax.AddBeginRequest("BeginAjaxRequest").ToString());
                    builder.Append(LineBrk);
                    builder.Append(AspNetAjax.AddEndRequest("EndAjaxRequest").ToString());
                    builder.Append(LineBrk);
                    builder.Append(FunctionStubStart("BeginAjaxRequest", new string[] { "sender", "args" }));
                    builder.Append(LineBrk);
                    builder = new StringBuilder(this.fire(this.AjaxRequestStart, builder.ToString()));
                    builder.Append(LineBrk);
                    builder.Append(this._InjectedAjaxRequestStart);
                    builder.Append(LineBrk);
                    builder.Append(FunctionStubEnd());
                    builder.Append(LineBrk);
                    builder.Append(FunctionStubStart("EndAjaxRequest", new string[] { "sender", "args" }));
                    builder.Append(LineBrk);
                    builder.Append(AspNetAjax.AjaxMessageHandlingStart(this.AjaxMessageKeeper, this.UpdateMsgSpliter));
                    builder.Append(LineBrk);
                    builder.Append(this.AjaxMsgFoundMethod);
                    builder.Append(LineBrk);
                    builder = new StringBuilder(this.fire(this.AjaxRequestEnd, builder.ToString()));
                    builder.Append(LineBrk);
                    builder.Append(this._InjectedAjaxRequestEnd);
                    builder.Append(LineBrk);
                    builder.Append(FunctionStubEnd());
                    builder.Append(LineBrk);
                    builder.Append(this.BeforeBody);
                    builder.Append(LineBrk);
                    builder = new StringBuilder(this.fire(this.NeedBodyContent, builder.ToString()));
                    builder.Append(LineBrk);
                    builder.Append(this.AfterBody);
                    builder.Append(LineBrk);
                    builder.Append(this._InjectedBodyScript);
                    if (!this.AddResourcesInHead)
                    {
                        builder.Append(this.IncludeResources());
                        builder.Append(LineBrk);
                    }
                    builder.Append(EndScript());
                    builder.Append(LineBrk);
                    writer.Write(builder.ToString());
                }
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }
        }
		// Private Methods (2) 

        private string fire(AjaxPlaceHolderEventHanlder Event, string ScriptContent)
        {
            AjaxPlaceHolderEventArgs e = new AjaxPlaceHolderEventArgs(ScriptContent);
            if (Event != null)
            {
                Event(this, e);
            }
            return e.ToString();
        }

        private string IncludeResources()
        {
            StringBuilder builder = new StringBuilder();
            foreach (string str in this.StyleSheets)
            {
                builder.Append(" <link href=\"");
                builder.Append(this.ResourceDirectory);
                builder.Append(str);
                builder.Append("| rel=|Stylesheet| type=|text/css| /> ".Replace("|", "\""));
            }
            foreach (string str2 in this.AdditionalStyleSheets)
            {
                builder.Append(" <link href=\"");
                builder.Append(str2);
                builder.Append("| rel=|Stylesheet| type=|text/css| /> ".Replace("|", "\""));
            }
            foreach (object obj2 in this._InjectedCssFiles)
            {
                builder.Append(" <link href=\"");
                builder.Append(this._InjectedCssFiles.ToString());
                builder.Append("| rel=|Stylesheet| type=|text/css| /> ".Replace("|", "\""));
            }
            foreach (string str3 in this.ScriptFiles)
            {
                builder.Append("<script src=\"");
                builder.Append(this.ResourceDirectory);
                builder.Append(str3);
                builder.Append("\" language=\"JavaScript\" type=\"text/javascript\"></script>");
            }
            foreach (string str4 in this.AdditionalScriptFiles)
            {
                builder.Append("<script src=\"");
                builder.Append(str4);
                builder.Append("\" language=\"JavaScript\" type=\"text/javascript\"></script>");
            }
            foreach (object obj3 in this._InjectedCssFiles)
            {
                builder.Append("<script src=\"");
                builder.Append(obj3.ToString());
                builder.Append("\" language=\"JavaScript\" type=\"text/javascript\"></script>");
            }
            if (HttpContext.Current.Session[PluginSessionkey] != null)
            {
                List<string> list = (List<string>) HttpContext.Current.Session[PluginSessionkey];
                foreach (string str5 in list)
                {
                    string str6 = str5.Substring(str5.Length - 3);
                    if (str6.ToLower() == ".js")
                    {
                        builder.Append("<script src=\"");
                        builder.Append(this.ResourceDirectory);
                        builder.Append(str5);
                        builder.Append("\" language=\"JavaScript\" type=\"text/javascript\"></script>");
                    }
                    if (str6.ToLower() == "css")
                    {
                        builder.Append(" <link href=\"");
                        builder.Append(str5);
                        builder.Append("| rel=|Stylesheet| type=|text/css| /> ".Replace("|", "\""));
                    }
                }
                foreach (IPlugin plugin in this.RegisteredPlugins)
                {
                    foreach (string str7 in plugin.ScriptFiles)
                    {
                        builder.Append("<script src=\"");
                        builder.Append(this.ResourceDirectory);
                        builder.Append(str7);
                        builder.Append("\" language=\"JavaScript\" type=\"text/javascript\"></script>");
                    }
                    foreach (string str7 in plugin.StyleSheets)
                    {
                        builder.Append(" <link href=\"");
                        builder.Append(str7);
                        builder.Append("| rel=|Stylesheet| type=|text/css| /> ".Replace("|", "\""));
                    }
                }
                HttpContext.Current.Session[PluginSessionkey] = null;
            }
            return builder.ToString();
        }

		#endregion Methods 
    }
}

